package be.idemditolommel.component;

import be.idemditolommel.constant.Tabs;
import com.vaadin.ui.Label;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.VerticalLayout;
import java.util.List;

public class MenuTabSheet extends TabSheet {

    private List<String> tabs = null;

    public MenuTabSheet(List<String> tabs) {
        this.tabs = tabs;
        addTabs();
    }

    public void addTabs() {
        for (String tabString : tabs) {
            VerticalLayout tab = new VerticalLayout();
            tab.setMargin(true);
            fillTab(tab, tabString);
            this.addTab(tab, tabString, null);
        }
    }

    private void fillTab(VerticalLayout tab, String tabString) {
        if (tabString.equals(Tabs.Menu.HOME)) {
            tab.addComponent(new Label(Tabs.Menu.HOME));
        } else if (tabString.equals(Tabs.Menu.ADMIN)) {
            tab.addComponent(new Label(Tabs.Menu.ADMIN));
        } else if (tabString.equals(Tabs.Menu.CONTACT)) {
            tab.addComponent(new Label(Tabs.Menu.CONTACT));
        } else if (tabString.equals(Tabs.Menu.LINKS)) {
            tab.addComponent(new Label(Tabs.Menu.LINKS));
        }
    }
}
